package tests;

import common.Utils;
import org.openqa.selenium.By;

import java.io.IOException;

public class UpdatePage extends Utils {
    public static String url="http://43.138.73.175:8080/book_update.html?bookId=2";
    public UpdatePage(){
        super(url);
    }

    public void UpdatePageSuc() throws IOException, InterruptedException {
        //通过查看页面元素观察是否加载完成列表页
        driver.findElement(By.cssSelector("body > div > div > h2 > span"));
        getScreenShot(getClass().getName());
        //修改图书信息
        driver.findElement(By.cssSelector("#bookName")).clear();
        driver.findElement(By.cssSelector("#bookAuthor")).clear();
        driver.findElement(By.cssSelector("#bookStock")).clear();
        driver.findElement(By.cssSelector("#bookPrice")).clear();
        driver.findElement(By.cssSelector("#bookPublisher")).clear();
        driver.findElement(By.cssSelector("#bookName")).sendKeys("更新书");
        driver.findElement(By.cssSelector("#bookAuthor")).sendKeys("更新作者");
        driver.findElement(By.cssSelector("#bookStock")).sendKeys("88");
        driver.findElement(By.cssSelector("#bookPrice")).sendKeys("88");
        driver.findElement(By.cssSelector("#bookPublisher")).sendKeys("更新出版社");
        driver.findElement(By.cssSelector("#updateBook > div:nth-child(8) > button.btn.btn-info.btn-lg")).click();
        Thread.sleep(2000);
    }
}
